Skip to content

Try and read package name from rescript.json if package.json is not present #7746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 8, 2025

Conversation

nojaf
Copy link
Member

@nojaf nojaf commented Jul 31, 2025

Use-case which @jderochervlk has with Deno.

@jfrolich setup is the following:

some-project
  - rescript.json
  - deno.json

User has no package.json, so we fallback to rescript.json for the name.
Do you see any problems with this?

Copy link

pkg-pr-new bot commented Jul 31, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7746

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7746

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7746

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7746

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7746

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7746

commit: cd80fa2

@nojaf nojaf marked this pull request as ready for review August 8, 2025 08:07
@nojaf nojaf force-pushed the fallback-name-rescript-json branch from 400ebbc to 2548ec5 Compare August 8, 2025 08:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds fallback functionality to read package names from rescript.json when package.json is not present, supporting use cases like Deno projects that don't use npm package files.

  • Modified read_package_name function to check for package.json existence before reading
  • Added fallback to read from rescript.json when package.json is missing
  • Updated changelog to document the enhancement

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
rewatch/src/build/packages.rs Added conditional logic to fallback to rescript.json when package.json is absent
CHANGELOG.md Added entry documenting the new fallback behavior

@nojaf nojaf enabled auto-merge (squash) August 8, 2025 11:44
@nojaf nojaf merged commit ead028b into rescript-lang:master Aug 8, 2025
40 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants